#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 10005;

int n, m;
int cnt[N];
void get_factor(int x) {
  for (int i = 2; i * i <= x; i++) {
    if (x % i == 0) {
      while (x % i == 0) cnt[i]++, x /= i;
    }
  }
  if (x != 1) cnt[x]++;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  rep(i, 2, n) get_factor(i);
  rep(i, 1, n) {
    if (cnt[i]) cout << i << ' ' << cnt[i] << endl;
  }
  return 0;
}